//
//  NewsTableViewCell.m
//  WWXELuShang
//
//  Created by lanou on 15/12/18.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "NewsTableViewCell.h"
#import "NewsModel.h"

@implementation NewsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = kBackGroundColor;
        self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake( kWidth / 40, kWidth / 37.5, kWidth / 3 , kWidth / 3 * 0.75)];
        self.iconView.image = [UIImage imageNamed:@"loadCar.jpeg"];
        [self.contentView addSubview:self.iconView];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth / 40 * 2 + kWidth / 3 , kWidth / 37.5, kWidth - (kWidth / 40 * 3 + kWidth / 3), kWidth / 3 * 0.75)];
        self.titleLabel.numberOfLines = 0;
        [self.contentView addSubview:self.titleLabel];
  
    }
    
    return self;
    
}


- (void)setNewsModel:(NewsModel *)newsModel {
    if (_newsModel != newsModel) {
        _newsModel = newsModel;
        self.iconView.image = [UIImage imageNamed:@"loadCar.jpeg"];
        self.titleLabel.text = newsModel.title;
        [self.iconView setImageWithURL:[NSURL URLWithString:newsModel.imglink]];
    }

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
